package com.mqtt.demo1.controller;

import com.mqtt.demo1.damain.User;
import com.mqtt.demo1.service.MqttService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author renyitong
 * @version 1.0.0
 * @createTime 2023年08月31日
 * @Description
 */
@RestController
@Slf4j
public class TestController {

    @Autowired
    private MqttService mqttService;

    @PostMapping("/send/msg")
    public String sendMessage(@RequestBody User user){
        log.info("user is {}",user);
        mqttService.sendMessage("youlemei",user);
        return "success";
    }

}
